var port=document.getElementById("port");
var ps=document.getElementById("ps");
var yz=document.getElementById("yz");
function Log(){
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+7);
	document.cookie="passport="+document.getElementById("port").value+";expires="+exdate.toGMTString()+";";
	var ps=document.getElementById("ps").value;
	var p=document.getElementById("password");
	p.value=hex_md5(ps);
	document.forms[0].submit();
};
function inputTxt(t,p){
	if(p){
		if(t.value==""){
			t.value='';
		}
		t.style.color='#333';
	}
	else{
		if(t.value==""){
			t.value='';
		}
		t.style.color='#C9C9C9';
	}
}
function cl(c){
	if(c.value=="商户ID或手机号码"){
		c.value="";
		c.style.color="#000";
		return;
	}
	if(c.value==""){
		c.value="商户ID或手机号码";
		c.style.color="#C9C9C9";
		return;
	}
}

$("#addFav").click(function(event){
	AddFavorite("http://www.12301.cc/",'票付通');
	event.preventDefault();
})
$("#setHome").click(function(event){
	SetHome(this,"http://www.12301.cc/");
	event.preventDefault();
})
 function AddFavorite(sURL, sTitle)
{
	try
	{
		window.external.addFavorite(sURL, sTitle);
	}
	catch (e)
	{
		try
		{
			window.sidebar.addPanel(sTitle, sURL, "");
		}
		catch (e)
		{
			alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}
function SetHome(obj,vrl)
{
	 if (document.all){  
        document.body.style.behavior='url(#default#homepage)';  
          document.body.setHomePage(window.location.href);  
    }else if (window.sidebar){  
        if(window.netscape){  
            try{  
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
            }catch (e){  
                alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );  
            }  
        }  
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);  
        prefs.setCharPref('browser.startup.homepage',window.location.href);  
    }else{  
        alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');  
    }  
}

function cookieLogin(){
	var cookie = document.cookie;
	var ac = cookie.split("; ");
	for(var i in ac){
		var cookieItem = ac[i];
		var key = cookieItem.replace(/=\S*/,"");
		var value = cookieItem.replace(/\S*=/,"");
		if(key == "passport"){
			document.getElementById("port").value = value;
			break;
		}
	}
}

